<?php
	session_start();
	$_SESSION["login"]=0;
	include '../connect/db_connect.php';
	//if(isset($_COOKIE['cookie'])){
//		 foreach ($_COOKIE["cookie"] as $name => $value)
//    {
//    echo "$name : $value";}
//		//echo 'user:'. $_COOKIE['cookie[user]'];
////		echo 'pass:'.$_COOKIE['cookie[pass]'];
//	}else{
	$user=mysql_real_escape_string($_GET['username']);
	$pass=mysql_real_escape_string($_GET['password']);
	$remem=mysql_real_escape_string($_GET['remem']);
	$sql="select * 
			from user 
			where username='{$user}' 
					and password='{$pass}'";
	$result=mysql_query($sql);
	if(!mysql_error()){
	
		if(mysql_num_rows($result)>0){
			$row=mysql_fetch_array($result);
			
			$_SESSION['username']=$row['username'];
			$_SESSION["login"]=1;
			//if($remem){
//				setcookie("cookie","loclhost/nhoquan",3);
//				setcookie("cookie[user]", $user );
//				setcookie("cookie[pass]", $pass);
//			}
			echo ($_SESSION['username']);
			unset($result, $row);
		}
		else{
		echo(0);
		
		exit();
		}
	}else echo  mysql_error();
//	}

?>